#include <iostream>
#include<string>
using namespace std;

int main() 
{
    int n;
    while(cin>>n)
    {
        int count=0;
        int max_count=0;
        string id,str;
        for(int i=0;i<n;i++)
        {
            cin>>id>>str;
            if(str=="connect")
            {
                count++;
            }
            if(max_count<count)
            {
                max_count=count;
            }
            if(str=="disconnect")
            {
                count--;
            }
        }
        cout<<max_count<<endl;
    }
}
